**********************
**********************
*Replication Code for

*Blasingame, Elise, Eric R. Hansen, and Richard Witmer. "Are Descriptive Representatives More Successful Passing Group-Relevant Legislation? The Case of Native American State Legislators." Political Research Quarterly.

*Compiled by Eric Hansen, 10/18/24 (ehansen4@luc.edu)
*Using StataIC 16.1.
**********************
**********************

*set working directory. Make sure all replication data are in this folder.

*cd [filepath]

*************
*Figure 1
*************
use "native_state_legislators_1993_2023.dta", clear

hist Year, freq ytitle("Native American Legislators Serving", margin(medsmall)) graphregion(fcolor(white)) color(gs12) lcolor(black) xscale(range(1993(10)2023)) xlabel(1993(10)2023)

**************
*Figure 2
**************

clear
**install these packages if not already installed
*ssc install spmap
*ssc install shp2dta
*ssc install mif2dta
*ssc install geo2xy

use "presence.dta", clear
gen STUSPS = st
merge 1:1 STUSPS using "geo2xy_us_data.dta"
drop if _merge!=3

*create map
*format college_real %4.2f
spmap presence using geo2xy_picard, clmethod(custom) clbreaks(0 1 50 100 200) id(_ID) fcolor(Greys) legtitle("Legislator-Years") legend(pos(5) row(6) ring(1) size(*1) symx(*1) symy(*1) forcesize label(2 "0") label(3 "1-50") label(4 "50-100") label(5 "100+"))


**************
*Remainder of analysis
**************

use "Blasingame_et_al_Replication_Data.dta", clear

********
*Recode variables
********
gen sponsortype = 0
replace sponsortype = 1 if PartyDiff=="0" 
replace sponsortype = 2 if PartyDiff=="1"
*0 = outside agency sponsor, 1 = partisan, 2 = bipartisan
gen pass = 0
replace pass = 1 if Status1=="Adopted" | Status1=="Enacted"
encode State, gen(stateid)
encode Topic1, gen(topicid)
recode GamingorHealthLeg (0=0) (1=1)(2=0), gen(gamingleg)
recode GamingorHealthLeg (0=0) (1=0)(2=1), gen(healthleg)
gen total_native = native_primary + native_sponsors
gen resolution = 0
replace resolution = 1 if Location == "ACR" | Location == "AJR" | Location == "AR" | Location == "HC" | Location == "HCM" | Location == "HCR" | Location == "HJM" | Location == "HJR" | Location == "HR" | Location == "HM"| Location == "LR" | Location == "R" | Location == "SM" | Location == "SR" | Location == "SJM" | Location == "SJR" | Location == "SCM" | Location == "SCR"
gen bill = 0
replace bill = 1 if Location == "A" | Location == "B" | Location == "H" | Location == "L" | Location == "LA" | Location == "S" | Location == "HSB" | Location == "SSB" 
gen senate = 0
replace senate = 1 if ChamberofOrigin=="S"


********
*Label variables
********

label var native_primary "Native Primary Author"
label var symbolic "Symbolic"
label var inmajority "Author in Chamber Majority"
label var splitgov "Split Control of Government"
label var senate "Originated in Senate"
label var gamingleg "Topic: Gaming"
label var healthleg "Topic: Health"
label var total_native "Count of Native Authors"
label var percentage_native "Pct. Native Authors"
label var resolution "Resolution"
label define sponsortype 0 "Non-Legislators" 1 "Partisan" 2 "Bipartisan"
label values sponsortype sponsortype
label var nativecomp "Native Legislators in Chamber"


************
*Figure 3
************

gen pass_bar = pass*100
recode native_primary (0=1) (1=0), gen(native_bar)
graph bar pass_bar, over(native_bar, relabel(1 "Native Sponsor" 2 "Non-Native Sponsor")) graphregion(fcolor(white)) ytitle("% Measures Passed", margin(medsmall))  bar(1, color("gs6")) yscale(range(0(20)100)) ylabel(0(20)100)

graph bar pass_bar, over(symbolic, relabel(1 "Symbolic" 2 "Substantive")) graphregion(fcolor(white)) ytitle("% Measures Passed", margin(medsmall))  bar(1, color("gs6")) yscale(range(0(20)100)) ylabel(0(20)100)

*t-test--mentioned in text
ttest pass_bar, by(native_bar)
ttest pass_bar, by(symbolic)

**************
*Figure A1
**************

gen maintopic = Topic1
replace maintopic = "Economic Development" if maintopic == "Economic Development " | maintopic == "Economic development" | maintopic == "Economic Devlopment" | maintopic == "Economic development " | maintopic == "Economic devlopment"
replace maintopic = "Education and Youth" if maintopic == "Education" | maintopic ==  "Education and Youth " | maintopic == "Education and youth"
replace maintopic = "Environment" if maintopic == "Environment "
replace maintopic = "Government to Government Relations" if maintopic== "Government to Government relations" | maintopic == "Government to government relations" 
replace maintopic = "Health and Human Services" if maintopic == "Health and Human Services " | maintopic == "Health and Humans Services" | maintopic == "Health and human services"
replace maintopic = "Historical Issues and Special Recognition" if maintopic == "Historial Issues and Special Recognition" | maintopic == "Historical Issues and Special Recognition " | maintopic == "Historical issues and special recognition" | maintopic == "historical issues and special recognition"
replace maintopic = "Miscellaneous" if maintopic == "miscellaneous" | maintopic == "."
replace maintopic = "State/Federal Recognition" if maintopic == "State/federal Recognition" | maintopic == "State/federal recognition" | maintopic == "Federal/state recognition"
replace maintopic = "Tax" if maintopic == "Tax "
recode maintopic = "" if maintopic=="0"

graph bar (count), over(maintopic, lab(ang(45) labsize(vsmall))) ytitle("Count of Bills", margin(medsmall)) graphregion(fcolor(white)) bar(1, color("gs6")) ylabel(0(200)600)

************
*Figure A2
************

encode state_abbrev, gen(abb)

hist abb, width(0.9999999) freq xlabel(1(1)51, val labsize(vsmall) ang(45)) xtitle("") note("") subtitle("") ylabel(0(50)300) graphregion(fcolor(white)) fcol(gs8) lcol(gs14) lwidth(vvthin) ytitle("Bills Introduced", margin(medsmall))

*************
*Figure A3
*************

hist Year,  width(0.999999999) freq xlabel(2010(1)2020, labsize(small)) xtick(2010(1)2020, tp(o)) xtitle("") note("") subtitle("") ylabel(0(100)500) graphregion(fcolor(white)) fcol(gs8) lcol(gs14) lwidth(vvthin) ytitle("Bills Introduced", margin(medsmall)) gap(10) barw(0.5)


**************
*Table A1
**************
sum pass native_primary total_native percentage symbolic nativecomp inmajority splitgov ib1.sponsortype resolution senate, detail

************
*Table A2
************

logit pass i.native_primary##i.symbolic nativecomp inmajority splitgov ib1.sponsortype resolution senate i.Year i.stateid, vce(cluster stateid)
logit pass c.total_native##i.symbolic nativecomp inmajority splitgov ib1.sponsortype resolution senate i.Year i.stateid, vce(cluster stateid)
logit pass c.percentage##i.symbolic nativecomp inmajority splitgov ib1.sponsortype resolution senate i.Year i.stateid, vce(cluster stateid)

************
*Figure 4
************

preserve
qui logit pass i.native_primary##i.symbolic nativecomp inmajority splitgov ib1.sponsortype resolution senate i.Year i.stateid, vce(cluster stateid)
tempfile tmp
margins, at(native_primary==(0 1) symbolic==(0 1)) saving ("`tmp'")
use "`tmp'", clear
graph twoway (bar _margin _at, barw(0.5) color(gs6)) (rcap _ci_ub _ci_lb _at, col(black)), xlabel(1 "Non-Native/Sub" 2 "Non-Native/Sym" 3 "Native/Sub" 4 "Native/Sym") legend(off) xtitle("") ytitle("P(Pass)", margin(medsmall)) graphregion(fcolor(white)) yscale(range(0(.2)1)) ylabel(0(0.2)1)
restore

*claim that AI and non-AI legislators pass symbolic bills at the same rate
margins, dydx(native_primary) at(symbolic==1)

*claim that AI legislators are significantly less likely to pass substantive bills than their non-AI colleagues (about 8 pp less likely to pass)
margins, dydx(native_primary) at(symbolic==0)

*claim that AI legislators pass symbolic legislation more than substantive legislation
margins, dydx(symbolic) at(native_primary==1)

*claim that non-AI legislators pass symbolic and substantive legislation at the same rate
margins, dydx(symbolic) at(native_primary==0)

*claim that descriptive reps have no special advantage in passing sym > sub compared to non-descriptive reps
qui logit pass i.native_primary##i.symbolic nativecomp inmajority splitgov ib1.sponsortype resolution senate i.Year i.stateid, vce(cluster stateid)
margins, at(native_primary==(0 1) symbolic==(0 1)) post
test (_b[2._at] - _b[1._at]) = (_b[4._at] - _b[3._at])

************
*Table A3
************
logit pass i.native_primary##i.symbolic nativecomp inmajority splitgov Seniority Committeechair leaderincSpeakerPresiden Majorityleader Minorityleader ib1.sponsortype resolution senate i.Year i.stateid, vce(cluster stateid)
logit pass c.total_native##i.symbolic nativecomp inmajority splitgov Seniority Committeechair leaderincSpeakerPresiden Majorityleader Minorityleader ib1.sponsortype resolution senate i.Year i.stateid, vce(cluster stateid)
logit pass c.percentage##i.symbolic nativecomp inmajority splitgov Seniority Committeechair leaderincSpeakerPresiden Majorityleader Minorityleader ib1.sponsortype resolution senate i.Year i.stateid, vce(cluster stateid)


*************
*Table A4
*************

*convert coding so that symbolic = 2, gray area bills = 1, substantive = 0
gen contsymb = 0
replace contsymb = 2 if symbolic == 1
replace contsymb = 1 if grayarea == 1
label var contsymb "Symbolism (Three-Point Scale)"
logit pass i.native_primary##c.contsymb nativecomp inmajority splitgov ib1.sponsortype resolution senate i.Year i.stateid, vce(cluster stateid)
logit pass c.total_native##c.contsymb nativecomp inmajority splitgov ib1.sponsortype resolution senate i.Year i.stateid, vce(cluster stateid)
logit pass c.percentage##c.contsymb nativecomp inmajority splitgov ib1.sponsortype resolution senate i.Year i.stateid, vce(cluster stateid)

**************
*Table A5
**************
logit pass i.native_primary##i.inmajority symbolic nativecomp splitgov ib1.sponsortype resolution senate i.Year i.stateid, vce(cluster stateid)
logit pass i.native_primary##i.symbolic##i.inmajority nativecomp splitgov ib1.sponsortype resolution senate i.Year i.stateid, vce(cluster stateid)

**************
*Table A6
**************

qui logit pass i.native_primary##i.inmajority symbolic nativecomp splitgov ib1.sponsortype resolution senate i.Year i.stateid, vce(cluster stateid)
margins, dydx(native_primary) at(inmajority=(0 1))

qui logit pass i.native_primary##i.symbolic##i.inmajority nativecomp splitgov ib1.sponsortype resolution senate i.Year i.stateid, vce(cluster stateid)
margins, dydx(native_primary) at(inmajority=(0 1) symbolic=(0 1))